package com.wakala.employment.adapter.bean;

import android.os.Parcel;
import android.os.Parcelable;

import java.io.Serializable;

/**
 * 用户地址表
 */
public class UserAddress implements Serializable, Parcelable {

    private static final long serialVersionUID=1L;

    //@ApiModelProperty(value = "用户地址id")
    private Long id;

    //@ApiModelProperty(value = "用户id")
    private Long uid;

    //@ApiModelProperty(value = "收货人姓名")
    private String realName;

    //@ApiModelProperty(value = "收货人电话")
    private String phone;

    //@ApiModelProperty(value = "收货人所在省")
    private String province;

    //@ApiModelProperty(value = "收货人所在市")
    private String city;

    //@ApiModelProperty(value = "城市id")
    private Integer cityId;

    //@ApiModelProperty(value = "收货人所在区")
    private String district;

    //@ApiModelProperty(value = "收货人详细地址")
    private String detail;

    //@ApiModelProperty(value = "收货人详细地址 地图POI名称")
    private String poiName;

    //@ApiModelProperty(value = "邮编")
    private Integer postCode;

    //@ApiModelProperty(value = "经度")
    private String longitude;

    //@ApiModelProperty(value = "纬度")
    private String latitude;

    //@ApiModelProperty(value = "是否默认")
    private Boolean isDefault;

    //@ApiModelProperty(value = "是否删除")
    private Boolean isDel;

    //@ApiModelProperty(value = "创建时间")

    public UserAddress(){}
    protected UserAddress(Parcel in) {
        if (in.readByte() == 0) {
            id = null;
        } else {
            id = in.readLong();
        }
        if (in.readByte() == 0) {
            uid = null;
        } else {
            uid = in.readLong();
        }
        realName = in.readString();
        phone = in.readString();
        province = in.readString();
        city = in.readString();
        if (in.readByte() == 0) {
            cityId = null;
        } else {
            cityId = in.readInt();
        }
        district = in.readString();
        detail = in.readString();
        poiName = in.readString();
        if (in.readByte() == 0) {
            postCode = null;
        } else {
            postCode = in.readInt();
        }
        longitude = in.readString();
        latitude = in.readString();
        byte tmpIsDefault = in.readByte();
        isDefault = tmpIsDefault == 0 ? null : tmpIsDefault == 1;
        byte tmpIsDel = in.readByte();
        isDel = tmpIsDel == 0 ? null : tmpIsDel == 1;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        if (id == null) {
            dest.writeByte((byte) 0);
        } else {
            dest.writeByte((byte) 1);
            dest.writeLong(id);
        }
        if (uid == null) {
            dest.writeByte((byte) 0);
        } else {
            dest.writeByte((byte) 1);
            dest.writeLong(uid);
        }
        dest.writeString(realName);
        dest.writeString(phone);
        dest.writeString(province);
        dest.writeString(city);
        if (cityId == null) {
            dest.writeByte((byte) 0);
        } else {
            dest.writeByte((byte) 1);
            dest.writeInt(cityId);
        }
        dest.writeString(district);
        dest.writeString(detail);
        dest.writeString(poiName);
        if (postCode == null) {
            dest.writeByte((byte) 0);
        } else {
            dest.writeByte((byte) 1);
            dest.writeInt(postCode);
        }
        dest.writeString(longitude);
        dest.writeString(latitude);
        dest.writeByte((byte) (isDefault == null ? 0 : isDefault ? 1 : 2));
        dest.writeByte((byte) (isDel == null ? 0 : isDel ? 1 : 2));
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<UserAddress> CREATOR = new Creator<UserAddress>() {
        @Override
        public UserAddress createFromParcel(Parcel in) {
            return new UserAddress(in);
        }

        @Override
        public UserAddress[] newArray(int size) {
            return new UserAddress[size];
        }
    };

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getUid() {
        return uid;
    }

    public void setUid(Long uid) {
        this.uid = uid;
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public Integer getCityId() {
        return cityId;
    }

    public void setCityId(Integer cityId) {
        this.cityId = cityId;
    }

    public String getDistrict() {
        return district;
    }

    public void setDistrict(String district) {
        this.district = district;
    }

    public String getDetail() {
        return detail;
    }

    public void setDetail(String detail) {
        this.detail = detail;
    }

    public String getPoiName() {
        return poiName;
    }

    public void setPoiName(String poiName) {
        this.poiName = poiName;
    }

    public Integer getPostCode() {
        return postCode;
    }

    public void setPostCode(Integer postCode) {
        this.postCode = postCode;
    }

    public String getLongitude() {
        return longitude;
    }

    public void setLongitude(String longitude) {
        this.longitude = longitude;
    }

    public String getLatitude() {
        return latitude;
    }

    public void setLatitude(String latitude) {
        this.latitude = latitude;
    }

    public Boolean getDefault() {
        return isDefault;
    }

    public void setDefault(Boolean aDefault) {
        isDefault = aDefault;
    }

    public Boolean getDel() {
        return isDel;
    }

    public void setDel(Boolean del) {
        isDel = del;
    }

}
